<script>
$(document).ready(function()
{
	<?php 
		if (isset($notify) && $notify != "")
		{
			if ($notify == "create_menu_success") {
				$type = "success";
				$title = "Thông báo";
				$text = "Bạn đã chỉnh sửa thành công.";
				$icon = "picon icon16 brocco-icon-info white";
			} elseif ($notify == "category_exists") {
				$type = "errorR";
				$title = "Thông báo";
				$text = "Thành phần đã tồn tại.";
				$icon = "picon icon16 brocco-icon-info white";
			} elseif ($notify == "create_menu_failed") {
				$type = "errorR";
				$title = "Thông báo";
				$text = "Tạo thất bại.";
				$icon = "picon icon16 brocco-icon-info white";
			}

			?>
			$.pnotify({
				type: '<?=$type?>',
			    title: '<?=$title?>',
	    		text: '<?=$text?>',
			    icon: '<?=$icon?>',
			    opacity: 0.9,
			    history: false,
			    sticker: false
			});
			<?
		}
	?>
	$("#edit_menu_form").validate({
    	rules: {
    		"menu[name]": {
				required: true
			},
		},
		messages: {
			"menu[name]": {
				required: "This field is required",
			},
		}	
    });
});
</script>
<div class="row-fluid">
    <div class="span12">
        <div class="box gradient">
            <div class="title">
                <h4>
                    <span><?php if (!isset($menu_id)) echo "Thêm mới thành phần menu"; else echo "Thay đổi thành phần menu"; ?></span>
                </h4>
            </div>
            <?php $action =  url_for('@menu_edit') ?>
            <div class="content" id="editMenuForm">
				<form class="form-horizontal" id="edit_menu_form" action="<?php echo $action ?>" method="post" enctype="multipart/form-data">
					<input type="hidden" name="menu[menu_id]" value="<?php echo (isset($menu_id) ? $menu_id : '') ?>">
                	<div class="form-row row-fluid">
                        <div class="span8">
                            <div class="row-fluid">
                                <?php echo $menu_form['name']->renderLabel(null, array("class"=>"form-label span3"));  ?>
                                <div class="span8 controls">
                                	<?php echo $menu_form['name']->render(array("id" => "name"));  ?>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-row row-fluid">
                        <div class="span8">
                            <div class="row-fluid">
                                <?php echo $menu_form['description']->renderLabel(null, array("class"=>"form-label span3"));  ?>
                                <div class="span8 controls">
                                	<?php echo $menu_form['description']->render(array("id" => "description"));  ?>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-row row-fluid">
                        <div class="span8">
                            <div class="row-fluid">
                                <?php echo $menu_form['href']->renderLabel(null, array("class"=>"form-label span3"));  ?>
                                <div class="span8 controls">
                                	<?php echo $menu_form['href']->render(array("id" => "href"));  ?>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-row row-fluid">
                        <div class="span8">
                            <div class="row-fluid">
                                <?php echo $menu_form['is_active']->renderLabel(null, array("class"=>"form-label span3"));  ?>
                                <div class="span8 controls">
                                	<?php echo $menu_form['is_active']->render(array("id" => "is_active"));  ?>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-row row-fluid">                              
                        <div class="span12">
                            <div class="row-fluid">
                                <div class="form-actions">
                                <div class="span3"></div>
                                <div class="span9 controls">
                                    <button type="submit" class="btn marginR10" name="create" value="Create" >Lưu</button>
                                    <button class="btn btn-danger">Làm lại</button>
                                </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
     </div>